import Vue from 'vue'
import App from './App.vue'
import BaiduMap from '@/components/vueBaiduMap'
import ECharts from 'vue-echarts'
import router from './router'
import vuescroll from 'vuescroll/dist/vuescroll-native'
import axios from 'axios'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import {  Pagination } from 'element-ui';

// import {  Select } from 'element-ui';

// echarts
import 'echarts/lib/chart/bar'
import 'echarts/lib/chart/pie'
import 'echarts/lib/chart/line'
import 'echarts/lib/chart/lines'
import 'echarts/lib/chart/radar'
import 'echarts/lib/component/tooltip'
import 'echarts/lib/component/legend'
import 'echarts/lib/component/title'
import 'echarts/lib/component/dataZoom'
import '../rem';
import service from './utils'
import scroll from 'vue-seamless-scroll'
Vue.use(scroll)
Vue.use(ElementUI);
Vue.use(Pagination);
// Vue.use(Select)

const toFix = (str)=>{
	return str<10?'0'+str:str
}

//设置cookie
const setCookie = (cname, cvalue, exdays) => {
    let d = new Date();
    d.setTime(d.getTime() + (exdays*24*60*60*1000));
    let expires = "expires="+d.toUTCString();
    document.cookie = cname + "=" + cvalue + "; " + expires;
}
//获取cookie
// const getCookie = (name)=>
// {
//     var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
//     return (arr=document.cookie.match(reg))?unescape(arr[2]):null;
// }
var basePath = ''
let loc = window.location.href;
if(loc.indexOf('krtservice')!=-1||loc.indexOf('localhost')!=-1){
	 basePath = "https://krtservice.com/nc_city_supervisor"
}else{
	 basePath = "http://223.82.98.207:8989/nc_city_supervisor"
}
console.log(basePath)
// basePath = "http://223.82.98.207:8989/nc_city_supervisor"



Vue.prototype.$http=axios;
Vue.prototype.$echarts = ECharts
Vue.prototype.$toFix = toFix
Vue.prototype.$setCookie = setCookie
// Vue.prototype.$getCookie = getCookie
Vue.prototype.$basePath = basePath
Vue.prototype.$axios = service

Vue.use(BaiduMap, {
  ak: 'R3ryLDazFlGr5UBAxhdHfn82',
  v:'3.0',
})
Vue.use(vuescroll);
Vue.config.productionTip = false
Vue.component('v-chart', ECharts);
new Vue({
	router,
	render: h => h(App),
}).$mount('#app')
